package com.rzht.framework.model.login;

import com.rzht.framework.base.BaseModel;
import com.rzht.framework.utils.RxUtils;

import io.reactivex.Observable;
import io.reactivex.Observer;

/**
 * Created by lk on 2017/7/26.
 */

public class LoginModel extends BaseModel {

    public static LoginModel getInstance() {
        return getPresent(LoginModel.class);
    }

    public void login(String username, String password, Observer<User> observer) {
        addParams("LOGIN_NAME", username);
        addParams("LOGIN_PASSWORD", password);
        Observable<User> observable = mServletApi.getUserInfo(mParams).compose(RxUtils.<User>handleResult());
        toSubscribe(observable, observer);
    }

}
